﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using StackExchange.Redis;

namespace Monitor.Core.Sensor
{
    class RedisSensor : AbstractSensor
    {
        public RedisSensor(int id, Uri uri)
            : base(id, uri)
        {
        }

        protected override ServiceStatus PingService()
        {
            using (var cnn = ConnectionMultiplexer.Connect(_uri.Host + ":" + _uri.Port))
            {
                var db = cnn.GetDatabase();
                TimeSpan span = db.Ping();
                return ServiceStatus.Alive;
            }
        }
    }
}
